package com.sky.mapper.admin;


import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.EmployeeDTO;
import com.sky.dto.EmployeePageQueryDTO;
import com.sky.enumeration.OperationType;
import com.sky.pojo.Employee;
import org.apache.ibatis.annotations.*;



public interface EmployeeMapper {

    /**
     * 根据用户名查询员工
     * @param username
     * @return
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);

    /**
     * 插入数据
     * @param
     */
    @AutoFill(value = OperationType.INSERT)
    void addEmployee(Employee employee);

    /*-- #判断是否有name，如果有就拼接条件，然后使用模糊查询name*/
    /*--  #降序排序*/
    Page<Employee> pageQuery(EmployeePageQueryDTO employeePageQueryDTO);

    void ActivateAndForbiddenEmp(Integer status, Long id);

    Employee getById(Long id);

    /**
     * 根据id修改分类
     * @param employee
     */
    @AutoFill(value = OperationType.UPDATE)
    void editEmployee(Employee employee);
    @Update("update employee set password=#{password} where id=#{userId}")
    void editPassword(Long userId, String password);
}
